import store from "../../store/store";
import deleteBatchItems from './deleteBatchItems'



export default function deleteSelected(keys) {

    let items = [];

    alert(keys)

    if(store.getState().moduleType=="folder"){
        for(let i = 0;i<keys.length;i++){
            items.push({
                FILE_ID:keys[i],
                FILE_TYPE:"folder"
            });
        }
    }
    else{
        let arr = JSON.parse(sessionStorage.getItem("getFile"))
        let tmpItems = []
        for(let i = 0;i<keys.length;i++){
            arr.map(item => {
                if(item.fileId == keys[i]){
                    tmpItems.push({
                        FILE_ID:item.fileId,
                        FILE_TYPE:item.fileType
                    })
                }
            });
        }
        items = tmpItems;
    }


    deleteBatchItems(items)

}